package org.wisigoth.chat.client.jabber;

import java.io.Writer;

import org.wisigoth.chat.client.exceptions.WisigothRuntimeException;

public class OutQueueThread extends Thread {
	private OutPacketQueue packetQ;
	private Writer out;
	
	public OutQueueThread (OutPacketQueue packetQ, Writer out) {
		this.packetQ = packetQ;
		this.out = out;
	}


	@Override
	public void run() {
		try {for (Packet packet = this.packetQ.pull(); packet != null; packet = this.packetQ
		.pull()) {
			packet.writeXML(this.out);
		}
		} catch (Exception e) {
			throw new WisigothRuntimeException("MessageThread " + e);
		}
		
	}
}
